package com.ruoyi.community.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.community.mapper.VisitMapper;
import com.ruoyi.community.domain.Visit;
import com.ruoyi.community.service.IVisitService;

/**
 * 访客Service业务层处理
 *
 * @author lj
 * @date 2022-02-22
 */
@Service
public class VisitServiceImpl implements IVisitService {
    @Autowired
    private VisitMapper visitMapper;

    /**
     * 查询访客
     *
     * @param id 访客主键
     * @return 访客
     */
    @Override
    public Visit selectVisitById(Long id) {
        return visitMapper.selectVisitById(id);
    }

    /**
     * 查询访客列表
     *
     * @param visit 访客
     * @return 访客
     */
    @Override
    public List<Visit> selectVisitList(Visit visit) {
        return visitMapper.selectVisitList(visit);
    }

    /**
     * 新增访客
     *
     * @param visit 访客
     * @return 结果
     */
    @Override
    public int insertVisit(Visit visit) {
        visit.setCreatTime(DateUtils.getNowDate());
        visit.setUpdateTime(DateUtils.getNowDate());
        visit.setDelFlag(0);
        return visitMapper.insertVisit(visit);
    }

    /**
     * 修改访客
     *
     * @param visit 访客
     * @return 结果
     */
    @Override
    public int updateVisit(Visit visit) {
        visit.setUpdateTime(DateUtils.getNowDate());
        return visitMapper.updateVisit(visit);
    }

    /**
     * 批量删除访客
     *
     * @param ids 需要删除的访客主键
     * @return 结果
     */
    @Override
    public int deleteVisitByIds(Long[] ids) {
        return visitMapper.deleteVisitByIds(ids);
    }

    /**
     * 删除访客信息
     *
     * @param id 访客主键
     * @return 结果
     */
    @Override
    public int deleteVisitById(Long id) {
        return visitMapper.deleteVisitById(id);
    }

    @Override
    public int updateVisitByIds(Long[] ids) {
        return visitMapper.updateVisitByIds(ids);
    }
}
